﻿using RXY_Mall.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using RXY_Mall.Domain;

namespace RXY_Mall.AdminApi.Models
{
    /// <summary>
    /// 商品广告输出信息
    /// </summary>
    public class GetGoodsListOutput
    {
        internal bool _is_coupon;
        internal int sort;
        internal DateTime add_time;
        internal gw_goods_collection goods_collection;

        /// <summary>
        /// 购物车
        /// </summary>
        internal List<CartOutput> cart { get; set; }

        /// <summary>
        /// 商品类型
        /// </summary>
        public GoodsType goods_type { get; set; }
        /// <summary>
        /// 商品ID
        /// </summary>
        public int goods_id { get; set; }
        /// <summary>
        /// 商品名称
        /// </summary>
        public string goods_name { get; set; }
        /// <summary>
        /// 商品图片
        /// </summary>
        public string picture_url { get; set; }
        /// <summary>
        /// 商品规格
        /// </summary>
        public string goods_spec { get; set; }
        /// <summary>
        /// 商品品牌
        /// </summary>
        public string goods_brand { get; set; }
        /// <summary>
        /// 助记符
        /// </summary>
        public string goods_mnemonic { get; set; }        
        /// <summary>
        /// 市场价
        /// </summary>
        public decimal market_price { get; set; }
        /// <summary>
        /// 平台价格
        /// </summary>
        public decimal sale_price { get; set; }
        /// <summary>
        /// 销售数量
        /// </summary>
        public int sale_count { get; set; }
        /// <summary>
        /// 是否置顶
        /// </summary>
        public bool is_top { get; set; }
        /// <summary>
        /// 是否新品
        /// </summary>
        public bool is_new { get; set; }
        /// <summary>
        /// 是否可销售
        /// </summary>
        public bool is_sale { get; set; }        
        /// <summary>
        /// 是否有券
        /// </summary>
        public bool is_coupon { get; set; }
        /// <summary>
        /// 店铺ID
        /// </summary>
        public int shop_id { get; internal set; }
        /// <summary>
        /// 分类ID
        /// </summary>
        public int category_id { get; internal set; }       
        /// <summary>
        /// 商品SKU
        /// </summary>
        public List<SkuOutput> skus { get; set; }
        public int goods_collection_id { get; internal set; }
    }

    /// <summary>
    /// 商品广告输出信息
    /// </summary>
    public class GetReturnedGoods : GetGoodsListOutput
    {
        /// <summary>
        /// 返回周期
        /// </summary>
        public int total_cycle { get; set; }
    }

    /// <summary>
    /// 商品详情
    /// </summary>
    public class GetGoodsOutput
    {
        //internal decimal? goods_service_rate;
        //internal decimal? category_service_rate;
        //internal gw_goods_rule_group goods_rule_group;
        //internal gw_goods_rule_free goods_rule_free;
        internal bool _deleted;
        internal byte _published;
        internal decimal? cost_price;
        internal gw_goods_collection goods_collection;

        /// <summary>
        /// 服务器时间戳
        /// </summary>
        public long server_time { get; set; }
        /// <summary>
        /// 商品ID
        /// </summary>
        public int goods_id { get; set; }
        /// <summary>
        /// 类别ID
        /// </summary>
        public int category_id { get; set; }
        /// <summary>
        /// 商品类型
        /// </summary>
        public GoodsType goods_type { get; set; }
        /// <summary>
        /// 商品名
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 市场价
        /// </summary>
        public decimal market_price { get; set; }
        /// <summary>
        /// 销售价
        /// </summary>
        public decimal sale_price { get; set; }
        /// <summary>
        /// 销售数
        /// </summary>
        public int sale_count { get; set; }
        /// <summary>
        /// 商品简述用于分享
        /// </summary>
        public string summary { get; set; }
        /// <summary>
        /// 商品详情
        /// </summary>
        public string description { get; set; }
        /// <summary>
        /// 轮播图
        /// </summary>
        public List<string> top_pictures { get; set; }
        /// <summary>
        /// 详情轮播图
        /// </summary>
        public List<string> detail_pictures { get; set; }
        /// <summary>
        /// 店铺
        /// </summary>
        public ShopOutput shop { get; set; }
        /// <summary>
        /// 商品SKU
        /// </summary>
        public List<SkuOutput> skus { get; set; }
        /// <summary>
        /// 商品收藏ID 0-未收藏
        /// </summary>
        public int goods_collection_id { get; internal set; }
        /// <summary>
        /// 评论数
        /// </summary>
        public int comment_count { get; set; }
        /// <summary>
        /// 商品SKU
        /// </summary>
        public List<CommentOutput> comments { get; set; }
        /// <summary>
        /// 商品标签
        /// </summary>
        public List<TagOutput> tags { get; set; }
        /// <summary>
        /// 商品服务
        /// </summary>
        public List<ServiceOutput> services { get; set; }        
        /// <summary>
        /// 优惠券
        /// </summary>
        public List<GetCouponOutput> coupons { get; set; }        
        /// <summary>
        /// 是否有券
        /// </summary>
        public bool is_coupon { get; set; }
        /// <summary>
        /// 短标题
        /// </summary>
        public string short_title { get; internal set; }
        /// <summary>
        /// 运费模板ID（新）
        /// </summary>
        public int? freight_template_id { get; internal set; }
        /// <summary>
        /// 重量
        /// </summary>
        public decimal? weight { get; internal set; }
        /// <summary>
        /// 体积
        /// </summary>
        public decimal? volume { get; internal set; }
        /// <summary>
        /// 规格（新）
        /// </summary>
        public string goods_spec { get; internal set; }
        /// <summary>
        /// 品牌（新）
        /// </summary>
        public string goods_brand { get; internal set; }
        /// <summary>
        /// 助记词（新）
        /// </summary>
        public string goods_mnemonic { get; internal set; }

        internal List<CartOutput> cart { get; set; }
    }

    public class ServiceOutput
    {
        /// <summary>
        /// 服务标题
        /// </summary>
        public string title { get; set; }
        /// <summary>
        /// 服务内容
        /// </summary>
        public string content { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int sort { get; set; }
    }


    /// <summary>
    /// 商品SKU输出类
    /// </summary>
    public class SkuOutput
    {
        internal string json_specs;
        internal decimal? cost_price;

        /// <summary>
        /// SKUID
        /// </summary>
        public int sku_id { get; set; }
        /// <summary>
        /// 缩略图
        /// </summary>
        public string thumb_url { get; set; }
        /// <summary>
        /// 市场价
        /// </summary>
        public Nullable<decimal> market_price { get; set; }
        /// <summary>
        /// 销售价
        /// </summary>
        public Nullable<decimal> sale_price { get; set; }
        /// <summary>
        /// 规格
        /// </summary>
        public List<SpecOutput> specs { get; set; }        
        /// <summary>
        /// 最大购买数
        /// </summary>
        public Nullable<int> limit_quantity { get; set; }
        /// <summary>
        /// 是否销售
        /// </summary>
        public bool is_sale { get; set; }
        /// <summary>
        /// 数量
        /// </summary>
        public int quantity { get; internal set; }
        /// <summary>
        /// 购物车
        /// </summary>
        public int cart_id { get; internal set; }
    }

    /// <summary>
    /// 商品规格输出类
    /// </summary>
    public class SpecOutput
    {
        /// <summary>
        /// 规格键
        /// </summary>
        public string spec_key { get; set; }
        /// <summary>
        /// 规格值
        /// </summary>
        public string spec_value { get; set; }
    }

    public class GetCommentsOutput
    {
        /// <summary>
        /// 评论数
        /// </summary>
        public int comment_count { get; set; }
        /// <summary>
        /// 评论列表
        /// </summary>
        public List<CommentOutput> comments { get; set; }
    }

    /// <summary>
    /// 商品评论输出类
    /// </summary>
    public class CommentOutput
    {
        internal DateTime add_time;
        internal string json_sku_specs;

        /// <summary>
        /// 商品评论ID
        /// </summary>
        public int comment_id { get; set; }
        /// <summary>
        /// 昵称
        /// </summary>
        public string nick_name { get; set; }
        /// <summary>
        /// 头像
        /// </summary>
        public string user_logo { get; set; }
        /// <summary>
        /// 商品规格
        /// </summary>
        public List<SpecOutput> sku_specs { get; set; }
        /// <summary>
        /// 评分
        /// </summary>
        public decimal rating { get; set; }
        /// <summary>
        /// 评论
        /// </summary>
        public string review { get; set; }
        /// <summary>
        ///  客户回复
        /// </summary>
        public string reply { get; set; }
        /// <summary>
        /// 赞同数量
        /// </summary>
        public int yes_total { get; set; }
        /// <summary>
        /// 反对数量
        /// </summary>
        public int no_total { get; set; }
        /// <summary>
        /// 评论时间
        /// </summary>
        public long comment_time { get; set; }
        /// <summary>
        /// 评论图片
        /// </summary>
        public List<string> comment_pictures { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int sort { get; internal set; }
    }

    /// <summary>
    /// 商品标签
    /// </summary>
    public class TagOutput
    {
        public int tag_id { get; set; }
        /// <summary>
        /// 标签名
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 数量
        /// </summary>
        public int number { get; set; }
        /// <summary>
        /// 积极指数
        /// </summary>
        public byte positive { get; set; }
    }

    /// <summary>
    /// 拼单订单
    /// </summary>
    public class OrderGroup
    {
        internal DateTime _expire_time;
        internal DateTime _add_time;
        internal DateTime? _complete_time;
        internal DateTime? _cancel_time;
        internal byte status;
        internal bool _is_returned;
        internal bool _is_coupon;

        /// <summary>
        /// 拼单ID
        /// </summary>
        public int order_group_id { get; set; }
        /// <summary>
        /// 拼单编号
        /// </summary>
        public string order_group_no { get; internal set; }
        /// <summary>
        /// 需要人数
        /// </summary>
		public int require_num { get; set; }
        /// <summary>
        /// 已有人数（废）
        /// </summary>
        public int users_num { get; set; }
        /// <summary>
        /// 过期时间
        /// </summary>
        public long expire_time { get; set; }
        /// <summary>
        /// 至少瓜分红包
        /// </summary>
        public decimal red_packet { get; set; }
        /// <summary>
        /// 拼单类型
        /// </summary>
        public GroupType group_type { get; set; }
        /// <summary>
        /// 发起时间
        /// </summary>
        public long add_time { get; internal set; }
        /// <summary>
        /// 取消时间
        /// </summary>
        public long cancel_time { get; set; }
        /// <summary>
        /// 完成时间
        /// </summary>
        public long complete_time { get; set; }
        /// <summary>
        /// 拼单状态
        /// </summary>
        public GroupStatus group_status { get; set; }
        /// <summary>
        /// 是否发红包
        /// </summary>
        public bool is_red_packet { get; set; }

        /// <summary>
        /// 参与人
        /// </summary>
        public List<GroupUser> group_users { get; internal set; }

        /// <summary>
        /// 拼单商品
        /// </summary>
        public GroupGoodsOutput goods { get; set; }

        /// <summary>
        /// 昵称（废）
        /// </summary>
        public string nick_name { get; set; }
        /// <summary>
        /// 用户图标（废）
        /// </summary>
		public string logo { get; set; }
        /// <summary>
        /// 拼主ID（废）
        /// </summary>
        public int user_id { get; set; }
        /// <summary>
        /// 店铺ID（废）
        /// </summary>
        public int shop_id { get; internal set; }
        /// <summary>
        /// 商品ID（废）
        /// </summary>
        public int goods_id { get; internal set; }
        /// <summary>
        /// 商品名称（废）
        /// </summary>
        public string goods_name { get; internal set; }
        /// <summary>
        /// 商品图片（废）
        /// </summary>
        public string picture_url { get; set; }
        /// <summary>
        /// 平台价（废）
        /// </summary>
        public decimal sale_price { get; set; }
        /// <summary>
        /// 销售数量（废）
        /// </summary>
        public int sale_count { get; internal set; }

        /// <summary>
        /// 是否有优惠券
        /// </summary>
        public bool is_coupon { get; internal set; }
        /// <summary>
        /// 是否补贴
        /// </summary>
        public bool is_returned { get; internal set; }
        public ShopOutput shop { get; internal set; }
    }
    /// <summary>
    /// 拼单商品
    /// </summary>
    public class GroupGoodsOutput
    {
        /// <summary>
        /// 店铺ID
        /// </summary>
        public int shop_id { get; set; }
        /// <summary>
        /// 商品ID
        /// </summary>
        public int goods_id { get; set; }
        /// <summary>
        /// 商品名
        /// </summary>
        public string goods_name { get; set; }
        /// <summary>
        /// 销售数量
        /// </summary>
        public int sale_count { get; set; }
        /// <summary>
        /// 图片
        /// </summary>
        public string picture_url { get; set; }
        /// <summary>
        /// 平台价
        /// </summary>
        public decimal sale_price { get; set; }
        /// <summary>
        /// 市场价
        /// </summary>
        public decimal market_price { get; internal set; }
        /// <summary>
        /// SKU
        /// </summary>
        public List<SkuOutput> skus { get; internal set; }
        /// <summary>
        /// 买点
        /// </summary>
        public string summary { get; internal set; }
        /// <summary>
        /// 是否有优惠券
        /// </summary>
        public bool is_coupon { get; internal set; }
        /// <summary>
        /// 是否补贴
        /// </summary>
        public bool is_returned { get; internal set; }
        /// <summary>
        /// 运费模板ID（新）
        /// </summary>
        public int? freight_template_id { get; internal set; }
        /// <summary>
        /// 重量（新）
        /// </summary>
        public decimal? weight { get; internal set; }
        /// <summary>
        /// 体积（新）
        /// </summary>
        public decimal? volume { get; internal set; }
        public GoodsType goods_type { get; internal set; }
    }

    /// <summary>
    /// 助力免单
    /// </summary>
    public class GoodsFree
    {
        /// <summary>
        /// 需要人数
        /// </summary>
        public int require_num { get; set; }
        /// <summary>
        /// 持续时间
        /// </summary>
        public int duration { get; set; }
        ///// <summary>
        ///// 开始时间
        ///// </summary>
        //public System.DateTime start_time { get; set; }
        ///// <summary>
        ///// 结束时间
        ///// </summary>
        //public Nullable<System.DateTime> end_time { get; set; }
        /// <summary>
        /// 是否销售
        /// </summary>
        public bool is_sale { get; set; }
    }

    /// <summary>
    /// 拼手气
    /// </summary>
    public class GoodsGroup
    {
        /// <summary>
        /// 至少瓜分红包
        /// </summary>
        public float red_packet { get; set; }
        /// <summary>
        /// 需要人数
        /// </summary>
        public int require_num { get; set; }
        /// <summary>
        /// 持续时间
        /// </summary>
        public int duration { get; set; }
        /// <summary>
        /// 是否销售
        /// </summary>
        public bool is_sale { get; set; }
    }


    /// <summary>
    /// 商品分类输出类
    /// </summary>
    public class GoodsCategoryOutput
    {
        /// <summary>
        /// 分类ID
        /// </summary>
        public int category_id { get; set; }

        /// <summary>
        /// 分类名称
        /// </summary>
        public string name { get; set; }

        /// <summary>
        /// 图片地址
        /// </summary>
        public string icon { get; set; }

        /// <summary>
        /// 下级商品分类
        /// </summary>
        public List<GoodsCategoryOutput> goods_categories { get; set; }
    }

    public class GoodsPoolItem
    {
        public int shop_id { get; set; }
        public int category_id1 { get; internal set; }
        public int category_id2 { get; internal set; }
        public int category_id3 { get; internal set; }
        public string goods_ids { get; set; }
    }

    public class GoodsOutput
    {
        /// <summary>
        /// 商品ID
        /// </summary>
        public int goods_id { get; set; }
        /// <summary>
        /// 商品类型
        /// </summary>
        public GoodsType goods_type { get; set; }
        /// <summary>
        /// 商品名
        /// </summary>
        public string goods_name { get; set; }
        /// <summary>
        /// 商品图片
        /// </summary>
        public string picture_url { get; set; }
        /// <summary>
        /// 商品价格
        /// </summary>
        public string goods_price { get; set; }
        /// <summary>
        /// 商品数量
        /// </summary>
        public int goods_quantity { get; set; }
        /// <summary>
        /// 商品规格
        /// </summary>
        public List<SpecOutput> specs { get; set; }
    }

}